#ifndef KEYPRESSFILTER_H
#define KEYPRESSFILTER_H

#include <QtCore/QObject>
#include <QtGui/QKeyEvent>

namespace hps {

// 事件过滤器， 需要安装在MainWindow中
class KeyPressFilter : public QObject {
protected:
    bool eventFilter(QObject *obj, QEvent *event) override {
        if (event->type() == QEvent::KeyPress) {
            QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
            if (keyEvent->modifiers() == Qt::ControlModifier && keyEvent->key() == Qt::Key_S) {
                // 在此处处理 Ctrl+S 快捷键的逻辑
                return true; // 拦截事件，阻止继续传递
            }
        }
        return QObject::eventFilter(obj, event);
    }
};

} // hps

#endif //KEYPRESSFILTER_H
